import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '@/components/Main.vue'
import Message from '../message/Message.vue';
import Flow from '@/views/Flow.vue';

Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/main'
}, {
  path: '/main',
  name: 'main',
  component: Main
}, {
  path: '/message',
  name: 'message',
  component: Message
}, {
  path: '/flow',
  name: 'flow',
  component: Flow
}, {
  path: '*',
  redirect: '/main'
}];

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router